import 'package:fish_redux/fish_redux.dart';

import 'action.dart';
import 'state.dart';

Reducer<LoginPhoneState> buildReducer() {
  return asReducer(
    <Object, Reducer<LoginPhoneState>>{
      LoginPhoneAction.action: _onAction,
      LoginPhoneAction.upPrivacy: _upPrivacy,
      LoginPhoneAction.upPhone: _upPhone,

    },
  );
}

LoginPhoneState _onAction(LoginPhoneState state, Action action) {
  final LoginPhoneState newState = state.clone();
  return newState;
}

LoginPhoneState  _upPrivacy(LoginPhoneState state, Action action) {
  final LoginPhoneState newState = state.clone();
  newState.isPrivacy = action.payload;
  return newState;
}

LoginPhoneState  _upPhone(LoginPhoneState state, Action action) {
  final LoginPhoneState newState = state.clone();
  newState.phone = action.payload;
  return newState;
}
